nodeTypeResolver = $nodeTypeResolver; } public function create(Array_ $array) : ?MethodCall { if (\count($array->items) !== 2) { return null; } $firstItem = $array->items[0]; $secondItem = $array->items[1]; if (!$firstItem instanceof ArrayItem) { return null; } if (!$secondItem instanceof ArrayItem) { return null; } if (!$secondItem->value instanceof String_) { return null; } if (!$firstItem->value instanceof PropertyFetch && !$firstItem->value instanceof Variable) { return null; } $firstItemType = $this->nodeTypeResolver->getType($firstItem->value); if (!$firstItemType instanceof TypeWithClassName) { return null; } $string = $secondItem->value; $methodName = $string->value; return new MethodCall($firstItem->value, $methodName); } }